-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #2516: Support Packaging and Distribution #2524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It seems to missing Dottydoc :) Is this publishable to homebrew as is, and could you take care of that? Otherwise LGTM |
The scripts are assumed to support |
@felixmulder I'm not sure if we need to publish the formula to Homebrew -- they have a lot of requirements on what can be accepted to brew-core, I think a shorter URL to the formula satisfy our need for now. |
For homebrew, I recommend creating a cask so users can install dotty via Reminds me there should really be a scala cask under |
dist/dotty.rb
Outdated
class Dotty < Formula | ||
desc "Experimental Scala Compiler" | ||
homepage "http://dotty.epfl.ch/" | ||
url "http://dotty.epfl.ch/dotty/dotty-0.1.1-bin-SNAPSHOT.tar.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the artifacts always be hosted on dotty.epfl.ch? Do you have scripts to automate the deployment?
I recommend against serving the files from an EPFL server. There have examples where servers hosting artifacts have been compromised http://www.techradar.com/news/popular-video-encoding-mac-app-handbrake-compromised-with-malware I think it would be best to serve these from for example Github releases or Maven Central. I have used https://github.com/aktau/github-release to automate this, but there are other ways.
Additionally, I suspect many will write installation scripts against this url scheme. For example nix, https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/scalafmt/default.nix I would recommend to try and keep this as stable as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the script I used to upload artifacts to github releases and update a homebrew formula https://github.com/scalameta/scalafmt/blob/ad8559939c7d32ca78dfedf3ebc4eebc2fda7257/bin/publish.sh#L52-L71 I don't use it anymore, I only publish to Maven Central now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the tip @olafurpg , I think we should automate the publishing to Github.
dist/dotty.rb
Outdated
desc "Experimental Scala Compiler" | ||
homepage "http://dotty.epfl.ch/" | ||
url "http://dotty.epfl.ch/dotty/dotty-0.1.1-bin-SNAPSHOT.tar.gz" | ||
sha256 "4e1bda148754543844d25290a87076e6bfb0b6b0275535f97c1871e0fc5c2c4c" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you upload the artifacts to Github releases, then the sha will be different than running sha locally. You would have to upload, download and then run sha on the dowloaded file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
I believe that it should be possible to provide a one-copy/paste install for all platforms in a similar way as ammonite (http://www.lihaoyi.com/Ammonite/#Ammonite-REPL) or Rust (https://www.rust-lang.org/en-US/install.html) However, I don't have much time at the moment to experiment with that. I think this is a great start!
dist/bin/dotd
Outdated
default_java_opts="-Xmx768m -Xms768m" | ||
bootcp=true | ||
|
||
PROG_NAME=dotty.tools.dottydoc.Main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixmulder could you give me a tip on how the dottydoc script works? The main difference from dotc
is just the main method?
I run dotd examples/hello.scala
locally, but it seems we need more libraries: java.lang.NoClassDefFoundError: com/vladsch/flexmark/util/options/MutableDataSet
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be fine - are you sure you've provided all dependencies? Dottydoc has some dependencies from Maven. See: https://github.com/lampepfl/dotty/blob/master/project/Build.scala#L304-L317
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixmulder We've a long list of dependencies if dottydoc
is included. It doesn't look very nice. How about we do some assembly
for dottydoc
and do it in a separate PR?
- ST4-4.0.7.jar
- antlr-3.5.1.jar
- antlr-runtime-3.5.1.jar
- autolink-0.6.0.jar
- flexmark-0.11.1.jar
- flexmark-ext-anchorlink-0.11.1.jar
- flexmark-ext-autolink-0.11.1.jar
- flexmark-ext-emoji-0.11.1.jar
- flexmark-ext-gfm-strikethrough-0.11.1.jar
- flexmark-ext-gfm-tables-0.11.1.jar
- flexmark-ext-gfm-tasklist-0.11.1.jar
- flexmark-ext-ins-0.11.1.jar
- flexmark-ext-superscript-0.11.1.jar
- flexmark-ext-tables-0.11.1.jar
- flexmark-ext-wikilink-0.11.1.jar
- flexmark-ext-yaml-front-matter-0.11.1.jar
- flexmark-jira-converter-0.11.1.jar
- flexmark-util-0.11.1.jar
- jackson-annotations-2.2.3.jar
- jackson-core-2.8.6.jar
- jackson-databind-2.2.3.jar
- jackson-dataformat-yaml-2.8.6.jar
- jsoup-1.7.2.jar
- liqp-0.6.7.jar
- snakeyaml-1.17.jar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@olafurpg I agree, we can improve the user experience for Linux/Windows as we go. Currently |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is good, but this implementation introduces a lot of duplication and possibility for bugs. The duplication is both between scripts in this PR and already existing scripts.
I propose we merge this scripts with current scripts in ./bin/ folder.
There's a lot of nececary functionality that is implemented there, such as crash handers and restoring of tty settings. The scripts has in ./bin
are inherited from @miniboxing and they are used to work on Windows(cygwin).
@@ -0,0 +1,116 @@ | |||
#!/usr/bin/env bash | |||
|
|||
if [ -z "$PROG_HOME" ] ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of copy paste and re-implementation for the current bin/dotc
script.
I propose we merge the two, otherwise it will be hard to maintain and we'll be using different scripts from the ones our users do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DarkDimius I agree there's a potential to merge the two. But I think we can delay the merge after the Copenhagen release -- as the bin/dotc
and bin/dotr
have something special to the development of the compiler, such as switch between bootstrap and unbootstrap versions. We can make the decision later.
dist/bin/dotd
Outdated
@@ -0,0 +1,114 @@ | |||
#!/usr/bin/env bash | |||
|
|||
if [ -z "$PROG_HOME" ] ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to write separate scripts for multiple entry points. See how it's done in ./bin/dotc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DarkDimius I didn't get your point. This piece of code is a reliable way to get the package home in order to run source "$PROG_HOME/bin/common"
. bin/dotr
and bin/dotc
do exactly the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By multiple entry points I've meant that you had similar scripts that differ only in what class they invoke in the end.
|
||
# Try to autodetect real location of the script | ||
|
||
if [ -z "$PROG_HOME" ] ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here.
@DarkDimius The new scirpts are supposed to support both Actually, I found bugs related to |
@liufengyun, ok, agreed. |
@DarkDimius I just removed Regarding |
I've published a test release in Now programmers can do the following:
It will be great that you can try the test release and give feedback, thanks a lot. |
@liufengyun, just tried it on my mac. Works good so far. |
@DarkDimius I updated the test release with your fixes, it works well 👍 |
dist/bin/dotc
Outdated
-nobootcp) unset bootcp && shift ;; | ||
-colors) colors=true && shift ;; | ||
-no-colors) unset colors && shift ;; | ||
-jrebel) jrebel=true && shift ;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this option being used?
dist/bin/dotc
Outdated
-colors) colors=true && shift ;; | ||
-no-colors) unset colors && shift ;; | ||
-jrebel) jrebel=true && shift ;; | ||
-no-jrebel) unset jrebel && shift ;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixmulder I get them from the bin/dotc
and bin/dotr
. It seems it's fine to remove them. Doing it now.
dist/bin/dotc
Outdated
-jrebel) jrebel=true && shift ;; | ||
-no-jrebel) unset jrebel && shift ;; | ||
|
||
-toolcp) require_arg classpath "$1" "$2" && toolcp="$2" && shift 2 ;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are currently not supporting toolcp
and it's not properly passed in bin/dotc
. So I remove it for now, and add it back when we have toolcp
support.
Failure is due to bintray resolution? |
Yes, I restarted it -- the |
Could you add the artifactory resolver to the build from Fabien so that we get the caching? |
@felixmulder The CI passes -- I didn't get the latest URL of the resolver, we do it separately? |
FWIW, here's how I enabled the artifactory resolver only for CI scalacenter/scalafix@1c021f8#diff-fdc3abdfd754eeb24090dbd90aeec2ceR87 |
But that does not enable the artifactory for resolving plugins, I would recommend instead to enable the artifactory globally in |
@liufengyun - yes, it'd be good to get the patch into the docker image as well, but that's of lower priority right now. |
Thanks @felixmulder ! If you decide to do a pre-release/release, you can follow the steps:
Note: the hash is different when the artefact is uploaded. The travis CI will notice that if it's not set properly. There's room to automate the process a little bit, but as we don't release daily, it's tolerable. |
Let's decide at the Monday meeting what to do. Thank for the info, looks great :) |
Fix #2516: This PR enable us to run
brew install lampepfl/brew/dotty
and then play withdotc/dotr
in command line.The packaging is based on sbt-pack:
sbt dist/pack
: generate package underdist/target/pack/
sbt dist/pack-archive
: generate.zip
and.tar.gz
files